<template>
  <div class="swiper-container" :class="name">
    <div class="swiper-wrapper">
      <slot></slot>
    </div>
    <!-- <div class="swiper-pagination"></div> 本来是在这里的，但是显示到最底部了。-->
  </div>
</template>

<script>
// import Swiper from 'swiper'
// import 'swiper/swiper.min.css'
// 上面是旧版本，不能用

// 下面是新版本，可以用
import Swiper from 'swiper/bundle'
import 'swiper/swiper-bundle.css'

export default {
  props: {
    perview: {
      type: Number,
      default: 1
    },
    name: {
      type: String,
      default: 'kerwin'
    }
  },
  mounted () {
    // console.log("mounted")
    new Swiper('.' + this.name, {
      // direction:"vertical", // 垂直
      slidesPerView: this.perview,
      spaceBetween: 30,
      // centeredSlides: true,
      freeMode: true
    })
  }
}
</script>
